package org.bmind.datasword.config.dto;

import java.util.ArrayList;
import java.util.Collection;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

import org.bmind.datasword.utils.EqualsUtil;
import org.bmind.datasword.utils.HashCodeUtil;
import org.bmind.datasword.utils.StorageUtilities;

//@XmlRootElement
public class DPreProcess  extends DObjIdentity {
	static { StorageUtilities.addREngineType(DPreProcess.class); }

	private int fHashCode;
	private Collection<DPreProcFunction> dPreProfunction = new ArrayList<DPreProcFunction>();
	private String hint = null;
	private String label = null;
	
	
	/**
	 * @return the hint
	 */
	public String getHint() {return hint;}
	@XmlElement
	public void setHint(String hint) {this.hint = hint;}
	
	/**
	 * @return the label
	 */
	public String getLabel() {return label;}
	@XmlElement
	public void setLabel(String label) {this.label = label;}
	
	/**
	 * @return the rPreProfunction
	 */
	public Collection<DPreProcFunction> getDPreProfunction() {return dPreProfunction;}
	@XmlElement
	public void setDPreProfunction(Collection<DPreProcFunction> dPreProfunction) {this.dPreProfunction = dPreProfunction;}	
	
	
	/* (non-Javadoc)
     * @see org.bmind.datasword.config.dto.DObjCommon#equals(java.lang.Object)
     */
    @Override
    public boolean equals(Object obj) {
        if ( this == obj ) return true;
 	    if ( !(obj instanceof DPreProcess) ) return false;
 	   
 	   DPreProcess dPp = (DPreProcess)obj;
 	    
     	return	EqualsUtil.areEqual(this.dPreProfunction, dPp.dPreProfunction);
    }

	/* (non-Javadoc)
     * @see org.bmind.datasword.config.dto.DObjCommon#hashCode()
     */
	@Override
	public int hashCode() {
		
		// this style of lazy initialization is
		// suitable only if the object is immutable
		if (fHashCode == 0) {
		int result = HashCodeUtil.SEED;
			result = HashCodeUtil.hash(result, dPreProfunction);
			fHashCode = result;
		}
		return fHashCode;
	}

	
	
}
